<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    var Array = {
        patrolDatas: [
            {
                id: "6dbf7ae4-0dea-47fe-b6e7-4a5d12fc6ecf",
                formId: "078ee653fd764eec8f7f34c66342e3e2",
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                patrolMonitorId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                keywords: null,
                timestamp: 1507683694000,
                data: {
                    1: "巡护人员记录_xunhurenyuanjilu__徐建国|徐振东|徐建仓|蒋自发|蒋全来|蒋顺来|蒋春根|赵金|赵财|赵鹏祥|赵鹏云"
                },
                typeName: null,
                lon: 115.8148502,
                lat: 40.50564196,
                alt: 0,
                altitude: 0,
                isTemplateData: null,
                imageMedias: [
                    {
                        id: "3cf1b6ef-2844-4c2e-99ab-c380865e67e1",
                        duration: 0,
                        type: "image",
                        path: "/upload/0000011/patrol/2017-10-11/3cf1b6ef-2844-4c2e-99ab-c380865e67e1.jpg",
                        patrolDataId: "6dbf7ae4-0dea-47fe-b6e7-4a5d12fc6ecf",
                        time: 1507683658774
                    }
                ],
                videoMedias: [],
                voiceMedias: null,
                ctime: "2017-10-11 09:01:34"
            }
        ],
        track: [
            {
                id: "2b0b6fc9-05ae-4922-9ca3-853cae6a429a",
                timestamp: 1507675631000,
                lon: 115.77503376,
                lat: 40.51997454,
                altitude: 895,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "89f9ff14-62ba-4288-9d0a-c699e15fbdb6",
                timestamp: 1507675641000,
                lon: 115.77501693,
                lat: 40.51986682,
                altitude: 911,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "fb0c5c11-c095-43dc-b528-3c441efa1a76",
                timestamp: 1507675780000,
                lon: 115.77501323,
                lat: 40.51976797,
                altitude: 933,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "39c9238f-27ce-4daf-81b7-b98cedd7ef0a",
                timestamp: 1507677286000,
                lon: 115.7748991,
                lat: 40.51999192,
                altitude: 1007,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "b5c6ee34-26c7-476c-a74d-8d0bc3a5c1f6",
                timestamp: 1507677394000,
                lon: 115.77503025,
                lat: 40.51981425,
                altitude: 913,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "42be0e86-14e7-4a0f-953c-a0cdddcf7c13",
                timestamp: 1507677414000,
                lon: 115.77503144,
                lat: 40.51995051,
                altitude: 925,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "e6563cc6-846f-4613-a468-73ddbe838159",
                timestamp: 1507677424000,
                lon: 115.77506098,
                lat: 40.52005148,
                altitude: 925,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "9e2eeda4-8111-4928-87cc-5831dcbd94d4",
                timestamp: 1507677444000,
                lon: 115.77509647,
                lat: 40.52015648,
                altitude: 943,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "0ed71901-d277-4088-8ae5-077d0ad65a2e",
                timestamp: 1507677679000,
                lon: 115.77511156,
                lat: 40.52015068,
                altitude: 945,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "9346ddfb-acf1-4ec4-9f04-887025424a2e",
                timestamp: 1507678540000,
                lon: 115.77481758,
                lat: 40.51974581,
                altitude: 917,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "c4b1ee30-f04d-4d91-b004-a97b90eb0c6e",
                timestamp: 1507678550000,
                lon: 115.77489108,
                lat: 40.51966017,
                altitude: 919,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "c1882c47-a101-4c11-973f-aafc79b48be8",
                timestamp: 1507678973000,
                lon: 115.77492513,
                lat: 40.52009362,
                altitude: 904,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "9b51e8b1-be5c-423b-a6f6-4fd0f90b81e1",
                timestamp: 1507678985000,
                lon: 115.77493849,
                lat: 40.51999794,
                altitude: 898,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "c0185bc8-2f94-4735-92a5-ef8bb63fc519",
                timestamp: 1507683645000,
                lon: 115.81471451,
                lat: 40.5052175,
                altitude: 757,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "6f7a71bd-d50c-42e4-a264-fb5261595b2a",
                timestamp: 1507683655000,
                lon: 115.81471204,
                lat: 40.5053647,
                altitude: 733,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "e6d503d0-93c9-4644-bcf9-0d9e2c2c1deb",
                timestamp: 1507683665000,
                lon: 115.81481953,
                lat: 40.50546037,
                altitude: 721,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "b09b419d-6886-4ca4-92fd-bb4cb5748a66",
                timestamp: 1507683676000,
                lon: 115.81488224,
                lat: 40.5055369,
                altitude: 719,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "372c9468-8d7b-481d-b360-fb45a34e723d",
                timestamp: 1507683690000,
                lon: 115.81477462,
                lat: 40.50558098,
                altitude: 721,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "2d2ef019-4e6f-4bda-a4d2-ff1bba5e00bb",
                timestamp: 1507683733000,
                lon: 115.81510629,
                lat: 40.50600218,
                altitude: 700,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "4cdf0c42-cbba-46f5-a843-5fdf050ca338",
                timestamp: 1507683763000,
                lon: 115.8151147,
                lat: 40.50609802,
                altitude: 721,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "cdfddb82-9620-49cf-a4b5-743166ca9a52",
                timestamp: 1507683812000,
                lon: 115.81508805,
                lat: 40.50623389,
                altitude: 723,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "17c4ae81-a27c-4264-aeba-6724cca1c730",
                timestamp: 1507683853000,
                lon: 115.81527966,
                lat: 40.50648736,
                altitude: 726,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "28fab964-5749-4ebb-8786-ad2851b9c94a",
                timestamp: 1507684762000,
                lon: 115.81759334,
                lat: 40.51269097,
                altitude: 756,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "3fafe0ef-3e6d-44eb-942e-19ce9526a4b3",
                timestamp: 1507693540000,
                lon: 115.82667342,
                lat: 40.52619904,
                altitude: 1149,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "07b0560c-b901-4686-a1b3-8f264ba4073b",
                timestamp: 1507694301880,
                lon: 115.82403083,
                lat: 40.52452601,
                altitude: 1076,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            },
            {
                id: "94d599ed-1b1e-4914-9d93-7510fca44ed2",
                timestamp: 1507694333000,
                lon: 115.82422379,
                lat: 40.52458808,
                altitude: 1029,
                patrolId: "c8fc6dd6-6e5b-4bbf-80e0-f3451656a65d",
                areaId: null
            }
        ]
    }

    var b = [];

    for (var i = 0; i < Array.track.length; i++) {
        var a = {
            "coord": [],
            "elevation": ""
        }
        a.coord[0] = Array.track[i].lon;
        a.coord[1] = Array.track[i].lat;
        a.elevation = Array.track[i].altitude;
        b.push(a);
    }
    console.log(b);

    var z=[];


    for (var i = 0; i < Array.patrolDatas.length; i++) {
        var g = {
            "coord": [],
            "elevation": ""
        }
        g.coord[0] =  Array.patrolDatas[i].lon;
        g.coord[1] =  Array.patrolDatas[i].lat;
        g.elevation =  Array.patrolDatas[i].altitude;

        z.push(g)
    }

    console.log(z);


    var Arrayshhh={
        "track":"",
        "waypoints":""
    }

    Arrayshhh.track = b;
    Arrayshhh.waypoints = z;
    console.log(Arrayshhh);

</script>
</body>
</html>